home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1Y8MUIN (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  2.1 KB  |  71 lines

  1. package java.beans;
  2.  
  3. import java.applet.Applet;
  4. import java.applet.AppletContext;
  5. import java.applet.AudioClip;
  6. import java.awt.Image;
  7. import java.awt.image.ImageProducer;
  8. import java.net.URL;
  9. import java.util.Enumeration;
  10. import java.util.Hashtable;
  11. import java.util.Vector;
  12.  
  13. class BeansAppletContext implements AppletContext {
  14.    Applet target;
  15.    Hashtable imageCache = new Hashtable();
  16.  
  17.    BeansAppletContext(Applet target) {
  18.       this.target = target;
  19.    }
  20.  
  21.    public Applet getApplet(String name) {
  22.       return null;
  23.    }
  24.  
  25.    public Enumeration getApplets() {
  26.       Vector applets = new Vector();
  27.       applets.addElement(this.target);
  28.       return applets.elements();
  29.    }
  30.  
  31.    public AudioClip getAudioClip(URL url) {
  32.       try {
  33.          return (AudioClip)url.getContent();
  34.       } catch (Exception var2) {
  35.          return null;
  36.       }
  37.    }
  38.  
  39.    public synchronized Image getImage(URL url) {
  40.       Object o = this.imageCache.get(url);
  41.       if (o != null) {
  42.          return (Image)o;
  43.       } else {
  44.          try {
  45.             o = url.getContent();
  46.             if (o == null) {
  47.                return null;
  48.             } else if (o instanceof Image) {
  49.                this.imageCache.put(url, o);
  50.                return (Image)o;
  51.             } else {
  52.                Image img = this.target.createImage((ImageProducer)o);
  53.                this.imageCache.put(url, img);
  54.                return img;
  55.             }
  56.          } catch (Exception var4) {
  57.             return null;
  58.          }
  59.       }
  60.    }
  61.  
  62.    public void showDocument(URL url) {
  63.    }
  64.  
  65.    public void showDocument(URL url, String target) {
  66.    }
  67.  
  68.    public void showStatus(String status) {
  69.    }
  70. }
  71.